using System;
using System.Text;
using System.Collections.Generic;

namespace VideoFlowTagger
{
	/// <summary>
	/// A Person object can either be producers, cast, screenwriters, or directors.
	/// <para>Syntax : --rDNSatom 'xml' name=iTunMOVI domain=com.apple.iTunes</para>
	/// </summary>
	public struct Person
	{
		private List<String> persons;
		private String keyTitle;
		
		public Person(String keyTitle)
		{
			this.persons = new List<String>();
			this.keyTitle = keyTitle;
		}
		
		public Person(String keyTitle, List<String> persons)
		{
			this.keyTitle = keyTitle;
			this.persons = persons;
		}
		
		public void AddPerson(String name)
		{
			persons.Add(name);
		}
		
		public void RemovePerson(String name)
		{
			persons.Remove(name);
		}
		
		public String GetPersons()
        {
            String result = "";
            foreach (String s in persons)
            {
                result += s + ", ";
            }
            return result;
        }
		
		public override string ToString ()
		{
			String result = "<key>" + keyTitle + "</key> <array> ";
			foreach (String s in persons)
			{
				result += "<dict> ";
				result +=     "<key>name</key> ";
				result +=     "<string>" + s + "</string> ";
				result += "</dict> ";
			}
			result += "</array> ";
			
			return result;
		}
	}
}

